(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "maishu-jueying", "./component", "react", "components/common/base-component", "maishu-services-sdk", "controls/image-manager", "components/common/custom-prop-editors"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    const maishu_jueying_1 = require("maishu-jueying");
    const component_1 = require("./component");
    const React = require("react");
    const base_component_1 = require("components/common/base-component");
    const maishu_services_sdk_1 = require("maishu-services-sdk");
    const image_manager_1 = require("controls/image-manager");
    const custom_prop_editors_1 = require("components/common/custom-prop-editors");
    class ImageEditor extends maishu_jueying_1.PropEditor {
        constructor(props) {
            super(props);
            this.imageService = base_component_1.createService(maishu_services_sdk_1.ImageService);
        }
        render() {
            let { value } = this.props;
            let bg = value ? this.imageService.imageSource(value) : component_1.MemberPage.defaultProps.bg;
            return React.createElement("span", { style: { display: 'table-cell', width: 120, height: 66, textAlign: 'center', cursor: 'pointer' } },
                React.createElement("img", { src: bg, style: { width: '100%', height: '100%' }, onClick: e => {
                        image_manager_1.showImageDialog(1, (imageIds) => {
                            this.props.updateComponentProp(imageIds[0]);
                        });
                    } }));
        }
    }
    let bg = "bg";
    maishu_jueying_1.Component.setPropEditor({
        componentType: component_1.MemberPage,
        propName: bg,
        editorType: ImageEditor,
        displayName: "背景图片"
    });
    let showBalance = "showBalance";
    maishu_jueying_1.Component.setPropEditor(({
        componentType: component_1.MemberPage,
        propName: showBalance,
        editorType: custom_prop_editors_1.checkbox("显示余额"),
        displayName: "余额"
    }));
    let showScore = "showScore";
    maishu_jueying_1.Component.setPropEditor({
        componentType: component_1.MemberPage,
        propName: showScore,
        editorType: custom_prop_editors_1.checkbox("显示积分"),
        displayName: "积分"
    });
});
